package edu.zhang.dao;

import java.sql.SQLException;

import org.apache.commons.dbutils.QueryRunner;
import org.apache.commons.dbutils.handlers.BeanHandler;


import edu.zhang.po.Admin;
import edu.zhang.util.MyDruidDataSource;

public class LoginDAO {
	private QueryRunner queryRunner = new QueryRunner(MyDruidDataSource.getDataSource());

	public Admin login(String account, String password) {
		Admin admin = null;
		String sql = "select * from admin where account = ? and password = ?";
		try {
			admin = queryRunner.query(sql, new BeanHandler<Admin>(Admin.class), account, password);
		} catch (SQLException e) {
			e.printStackTrace();
		}
		return admin;
	}
	
}
